// 导入Vue框架
import Vue from 'vue';
// 导入app.vue组件
import App from './app.vue';
import VueRouter from 'vue-router';
import iView from 'iView';
import 'iview/dist/styles/iview.css';

// 配置路由
Vue.use(VueRouter);
const Routers = [
	{
		path: '/login',
		component: (resolve) => require(['./views/login.vue'], resolve)
	},
	{
		path: '/home',
		component: (resolve) => require(['./views/home.vue'], resolve)
	}, 
	{
		path: '*',
		redirect: '/login'
	}
]
const RouterConfig = {
	mode: 'history',
	routes: Routers
}
const router = new VueRouter(RouterConfig);

Vue.use(iView);

// 创建Vue根实例
new Vue({
	el: '#app',
	router: router,
	/**
	 * =>是箭头函数
	 * render: h => h(App)等同于:
	 * render: function(h){
	 *	return h(App) 
	 * }
	 */
	render: h => h(App)
})
